
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Random;

import be.bonamis.umpire.domain.quiz.Quiz;

public class Dddd {

	public static void main(String args[]) {

		log("Generating 5 random integers in range ..5");

		// note a single Random object is reused here
		Random randomGenerator = new Random();
		for (int idx = 1; idx <= 5; ++idx) {
			int randomInt = randomGenerator.nextInt(5)+1;
			log("Generated : " + randomInt);
		}

		log("Done.");

		Dddd deserializer = new Dddd();
		Quiz address = deserializer.deserialzeAddress();
		System.out.println(address.getCreationDay());

	}

	public Quiz deserialzeAddress() {

		Quiz address;

		try {

			FileInputStream fin = new FileInputStream("c:\\brol\\quiz.ser");
			ObjectInputStream ois = new ObjectInputStream(fin);
			address = (Quiz) ois.readObject();
			ois.close();

			return address;

		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}

	private static void log(String aMessage) {
		System.out.println(aMessage);
	}

}
